<extend name="Public/base"/>
<block name="content">
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">超级VIP申请管理</strong>  <small></small></div>
            </div>

            <hr>
            <div class="am-g">
                <!--<div class="am-u-sm-12 am-u-md-6">-->
                    <!--<div class="am-btn-toolbar">-->
                        <!--<div class="am-btn-group am-btn-group-xs">-->
                            <!--<a href="{:U('reward/add_lottery')}" type="button" class="am-btn am-btn-primary"><span class="am-icon-plus"></span> 新增</a>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
                <div class="am-u-sm-12">
                    <!--<form class="am-form">-->
                    <table class="am-table am-table-striped am-table-hover table-main">
                        <thead>
                        <tr>
                            <th class="table-id">序号</th>
                            <th class="table-title">申请人</th>
                            <!--<th class="table-url">申请的代理商等级</th>-->
                            <!--<th class="table-url">是否内部会员</th>-->
                            <th class="table-url">赠送数量</th>
                            <th class="table-url">释放数量</th>
                            <th class="table-url">剩余数量</th>
                            <th class="table-url">总业绩</th>
                            <th class="table-url">累积业绩</th>
                            <th class="table-url">当月新增业绩</th>
                            <th class="table-url">当月取出业绩</th>
                            <th class="table-url">划转数量</th>
                            <th class="table-type">申请时间</th>
                            <th class="table-type">通过时间</th>
                            <th class="table-type">状态</th>
                            <th class="table-type">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <volist name="data" id="vo" empty="暂无数据">
                            <tr>
                                <td>{$key+1}</td>
                                <td>{$vo.username}</td>
                                <!--<td>-->
                                    <php>
                                        $agent=C('agent_level');
                                    </php>
                                    <!--{$agent[$vo['sub_level']]}-->

                                <!--</td>-->
                                <!--<td>-->
                                    <!--<if condition="$vo.is_insider eq 1">-->
                                        <!--内部会员-->
                                        <!--<else />-->
                                        <!--非内部会员-->
                                    <!--</if>-->
                                <!--</td>-->
                                <td>{$vo.amount}</td>
                                <td>{$vo.release_amount}</td>
                                <td style="color: blue;">{$vo['amount']-$vo['release_amount']}</td>
                                <td>{$vo.all_zong}</td>
                                <td>{$vo.leiji_zong}</td>
                                <td>{$vo.month_zong}</td>
                                <td>{$vo.out_zong}</td>
                                <td>{$vo.transfer}</td>
                                <td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
                                <td>{$vo.sure_time|date='Y-m-d H:i:s',###}</td>
                                <td>
                                    <if condition="$vo.status eq 2">
                                        <span>释放完成</span>
                                        <elseif condition="$vo.status eq 1"/>
                                        <span>释放中</span>
                                        <else/>
                                        <span>其他</span>
                                    </if>
                                </td>
                                <td>
                                    <button class="am-btn-warning agent_check" agent_id="{$vo.id}">手动释放</button>

                                </td>
                            </tr>
                        </volist>
                        </tbody>
                    </table>
                    <!--</form>-->
                    <div class="am-cf">
                        共 {$count} 条记录
                        <div class="am-fr">
                            <ul class="am-pagination">
                                {$show}
                            </ul>
                        </div>
                    </div>
                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2020 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>
        <style>
            .am-btn-warning{
                color: black;
            }
        </style>
    </div>
</block>
<block name="js">
    <script src="__COMMON__/js/jquery.min.js"></script>
    <script>
        //备注
        $('.agent_check').click(function () {
            var id = $(this).attr('agent_id');
            layer.open({
                id:1,
                type: 1,
                title:'请输入释放金额',
                skin:'layui-layer-rim',
                area:['450px', 'auto'],
                content: ' <div class="row" style="width: 420px;  margin-left:7px; margin-top:10px;">'
                    +'<div class="col-sm-12">'
                    +'<div class="input-group">'
                    +'<textarea id="money" style="width: 100%" class="form-control" >'
                    +'</textarea>'
                    +'</div>'
                    +'</div>'
                    +'</div>'
                ,
                btn:['提交','取消'],
                btn1: function (index,layero) {
                    var money = $('#money').val();
                    $.post("__ACTION__",{id:id,money:money},function (data) {
                        layer.msg(data.message,{time:3000},function () {
                            if(data.code<0){
                                return false;
                            }else{
                                window.location.reload();
                            }
                        })
                    },'json')
                },
                btn2:function (index,layero) {
                    layer.close(index);
                }

            });
        });

        $(".sure").click(function () {
            $id=$(this).attr('agent_id');
            if(confirm("确定执行此操作吗")){
                $.ajax({
                    type:"post",
                    dataType:"json",
                    url:"{:U('sure_agent')}",
                    data:{
                        id:$id,
                    },
                    success:function (data) {
                        if(data.code>0){
                            alert(data.message);
                            window.location.reload();
                        }else {
                            alert(data.message);
                        }
                    }
                })
            }
        })

        $(".bohui").click(function () {
            $id=$(this).attr('agent_id');
            if(confirm("确定执行此操作吗")){
                $.ajax({
                    type:"post",
                    dataType:"json",
                    url:"{:U('bohui_agent')}",
                    data:{
                        id:$id,
                    },
                    success:function (data) {
                        if(data.code>0){
                            alert(data.message);
                            window.location.reload();
                        }else {
                            alert(data.message);
                        }
                    }
                })
            }
        })
    </script>
</block>